﻿using System;
using System.Collections.Generic;
using System.Linq;
using ExpenseSystem.Common;
using ExpenseSystem.Fether;
using ExpenseSystem.Lor;
using ExpenseSystem.Model;

namespace ExpenseSystem.Fether
{
    public class SiteFetcher:SystemFetcher<SiteModel>
    {
        public SiteModel GetByCode(string code, out string message)
        {
            int rows;
            IList<SiteModel> result = List( OrderBy.GetDefault(), Limit.GetDefault(), out message, out rows, Restrain.Eq("Code", code).And(Restrain.Eq("Avaliable", true)));
            if (result.Count > 0)
                return result.First();
            else
                return null;
        }
    }
}
